<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.*,
				 java.io.PrintWriter,
                 com.kylin.common.*,
                 com.kylin.common.util.*,
                 com.kylin.module.specials.orm.*,
				 com.kylin.module.specials.forms.*,
				 com.kylin.common.dict.orm.Dict,
                 com.kylin.common.paginate.DisplayPage
                 "%>
<%@ include file="/common/include/taglibs.jsp"%>
<%@ include file="/common/include/pageExpires.jsp"%>
<%@ include file="/common/include/dictNames.jsp"%>


<%
	SpecialPart part1 = new SpecialPart();
	SpecialPart part2 = new SpecialPart();
	SpecialPart part3 = new SpecialPart();
	SpecialPart part4 = new SpecialPart();
	SpecialPart part5 = new SpecialPart();

	if (request.getAttribute(Constants.KEY_REQUEST_RESULT) instanceof List) {
		List allData = (List) request.getAttribute(Constants.KEY_REQUEST_RESULT);
        if(allData.size() < 5){
            out.println("系统缺少专题类别，请在系统管理中添加");
        }else{
            part1 = (SpecialPart)allData.get(0);
            part2 = (SpecialPart)allData.get(1);
            part3 = (SpecialPart)allData.get(2);
            part4 = (SpecialPart)allData.get(3);
            part5 = (SpecialPart)allData.get(4);
        }
	}
	String specialListUrl = "/module/special/manageSpecial.do?CMD=listByCat&id=";
	String specialDetailUrl = "/module/special/manageSpecial.do?CMD=detailSpecial&id=";
	
%>
<table width="96%" cellspacing="0" cellpadding="0" memo="主专题和广告">
	<tr>
		<td align="left" valign="top">
			<table width="96%" cellspacing="0" cellpadding="0" memo="热点经济">
				<tr>
					<td class="stitle">
                      <%=part1.getPartName() %> 
                    </td>
					<td align="right" bgcolor="E2E2E2">
				<% if(part1.getSpecialCat() != null){ %>
					   <a href="<%=specialListUrl + part1.getSpecialCat().getId()%>" target="_blank"><img src="/images/spepic02.gif" width="34" height="6"></a>
				<% } %>
						&nbsp;&nbsp;
					</td>
				</tr>
				<tr class="s01">
					<td width="220" align="center" valign="top">
				<%
				    if(part1.getPartTop() != null){
				%>								
						<table width="98%" cellspacing="0" cellpadding="0">
							<tr>
								<td align="center">
									<a href="<%=specialDetailUrl + part1.getPartTop().getId()%>" target="_blank">
									   <img src="/fileOutServlet?imgType=<%=Constants.IMG_SPECIAL%>&imgurl=<%=part1.getPartTop().getTitleimage()%>"
													width="170" height="120" border="0"> 
									</a>
								</td>
							</tr>
							<tr>
								<td align="left">
								  <b><a href="<%=specialDetailUrl + part1.getPartTop().getId()%>" target="_blank">
								         <%=part1.getPartTop().getTitle()%> 
								  </a></b>
									<br>
									<%=JspHelper.substring(part1.getPartTop().getContent(),200,"")%>
								</td>
							</tr>
						</table>
				<%  
					}else{
					    out.println("本专题区没有头条新闻");
					} 
				%>
					</td>
					<td valign="top" style="line-height:20px;">
				<%
				    if(part1.getSpecials() != null){
				        for(int i=0;i < part1.getSpecials().size(); i++){
				            Special special = (Special)part1.getSpecials().get(i);
				%>
							&#149;&nbsp;
							<a href="<%=specialDetailUrl + special.getId()%>" target="_blank">
								<%=special.getTitle()%>
							</a>
							<br>				
				<%            
				        }
				    }else{
					    out.println("本专题区没有新闻");
					}
				%>
						&nbsp;
					</td>
				</tr>
			</table>
		</td>
		<td width="200" valign="top">
			<script type="text/javascript"><!--
google_ad_client = "pub-6007578250513537";
/* 200x200, 创建于 08-5-14 */
google_ad_slot = "9776800398";
google_ad_width = 200;
google_ad_height = 200;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<br>
<script type="text/javascript"><!--
google_ad_client = "pub-6007578250513537";
/* 200x90, 创建于 08-5-15 */
google_ad_slot = "8553469459";
google_ad_width = 200;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

	</td>
	</tr>
</table>
<br>

<table width="98%" border="0" cellspacing="0" cellpadding="0">
	<tr valign="top">
		<td width="50%">
			<% showOtherPart( out, part2, specialListUrl, specialDetailUrl);  %>
		</td>
		<td width="50%" align="right">
			<% showOtherPart( out, part3, specialListUrl, specialDetailUrl);  %>
		</td>
	</tr>
</table>
<br>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
	<tr valign="top">
		<td width="50%">
			<% showOtherPart( out,part4, specialListUrl, specialDetailUrl);  %>
		</td>
		<td width="50%" align="right">
			<% showOtherPart( out,part5, specialListUrl, specialDetailUrl);  %>
		</td>
	</tr>
</table>

<%!
    /**
        专题首页其他专题版块样式相同，可以用一个方法输出
    */
    public void showOtherPart(JspWriter out,SpecialPart thePart,String specialListUrl,String specialDetailUrl) throws Exception{
out.println("  <table width='97%' cellspacing='0' cellpadding='0' memo='政治风云'> ");             
out.println("  	<tr class='s02'>             ");
out.println("  		<td width='200'>         ");
out.println("  		" + thePart.getPartName() );
out.println("  		</td>		             ");
out.println("  		<td align='right'>       ");
if(thePart.getSpecialCat() != null){
	out.println("  	 <a href='"+specialListUrl + thePart.getSpecialCat().getId()+"' ");
	out.println("  	 		target='_blank'><img src='/images/spepic02.gif' width='34' height='6'></a>");
}
out.println("  			&nbsp;&nbsp;                                          ");
out.println("  		</td>                                                     ");
out.println("  	</tr></table><table width='97%' cellspacing='0' cellpadding='0' memo='政治风云'>");
out.println("  	<tr class='s0201'>                                            ");
out.println("  		<td align='center' valign='top'>&nbsp;                    ");
if(thePart.getPartTop() != null){
	out.println("  	<img src='/fileOutServlet?imgType="+ Constants.IMG_SPECIAL 
	            	  +"&imgurl=" + thePart.getPartTop().getTitleimage() 
	            	  +"' width='130' height='90'>   "); 
} 
out.println("  		</td>                                                      ");
out.println("  		<td valign='top'>&nbsp;                                    ");
if(thePart.getPartTop() != null){
	out.println("  	<b><a href='" + specialDetailUrl 
						   + thePart.getPartTop().getId() + "' target='_blank'>");
	out.println(    thePart.getPartTop().getTitle() );                   
	out.println("  		  </a></b>                 ");
	out.println("  		  <br>                     ");
	out.println( JspHelper.substring(thePart.getPartTop().getContent(),120,"") );
}
out.println("  		</td>                          ");
out.println("  	</tr>                              ");
out.println("  </table>                            ");

    }
%>